#include <stdio.h>  
#include <math.h>  
  
int main() {  
    int n, minNum, maxNum, flowerNum = 0, bit, cnt = 0;  
    if (scanf("%d", &n));  
    minNum = pow(10, n - 1);  
    maxNum = minNum * 10;  
    bit = n;  
    for (int i = minNum; i < maxNum; i++, bit = n, flowerNum = 0) {  
        int temp = i;  
        while (bit--) {  
            flowerNum += pow(temp % 10, n);  
            temp /= 10;  
        }  
        if (flowerNum == i) {  
            printf("%d\n", i);  
            cnt++;  
        }  
    }  
    if (!cnt)  
        printf("No output.\n");  
    return 0;  
}  